﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ToppingControl.Models.TopCordPlanModel.TopCordPlan_DS>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
   Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
   <h2 style="color: #191970">
       Login</h2>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="TableContent" runat="server">
<style type="text/css">
      .fontTB
      {
         font-size: 18pt !important;
      }
            #code ,#txtShift ,#txtname
      {
         font-size:1em; height:2em;
         line-height:2.5em;
         width:350px;
      } 
      .cell
      {
          width:40% !important
      }
      </style>
   <table style="margin-top: 25px; width:75%" class="fontTB">

      <tr style="height: 35px">
         <td class="head cell">
            Shift :
         </td>
         <td class="desc">
            <input id="txtShift" type="text" maxlength="1" value="1" />
         </td>
      </tr>

      <tr style="height: 35px">
         <td class="head cell">
            Topping Code :
         </td>
         <td class="desc">
            <input id="code" type="password" value="" />
         </td>
      </tr>
      <tr style="height: 35px">
         <td class="head cell">
            NAME :
         </td>
         <td class="desc">
            <input id="txtname" type="text" maxlength="30" value=""/>
         </td>
      </tr>
      <tr class="head">
         <td style="height: 35px; text-align: right;">
            <button id="exit">
               Exit</button>
         </td>
         <td style="height: 35px; text-align: left;">
            <button id="save">LogIn</button>
         </td>
      </tr>
   </table>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="ScriptsSection" runat="server">
   <% if (false)
      { %>
   <script src="../../Scripts/jquery-1.7.2.js" type="text/javascript"></script>
   <% } %>
   <script type="text/javascript">
       $(function () {
           $("#code").focus();
           $("#save").button({
               icons: { primary: "" }
           }).click(function () {
               var code = $("#code").val();
               if (code == "") {
                   alert("ระบุ Topping Code ! ");
                   $("#code").focus();
                   return;
               }
               if ($("#txtShift").val() == "") {
                   $("#txtShift").focus();
                   alert("ระบุ Shift ! ");
                   return;
               }
               if ($("#txtname").val() == "") {
                   alert("ระบุ Name ! ");
                   $("#txtname").focus();
                   return;
               }

               if (code == "8858722100049") {
                   //Topping Head 
                   var shift = $("#txtShift").val();
                   var emp = $("#txtname").val();

                   var url = '<%=Url.Action("Register","HeaderLine") %>?shift=' + shift + '&emp=' + emp + '&code=' + code;
                   Clear_Text();
                   window.open(url, "Header_line", "fullscreen=yes,menubar=0,location=0,status=0 ");
               }
               if (code == "1000568858722") {
                   //Topping Tail 
                   var shift = $("#txtShift").val();
                   var emp = $("#txtname").val();
                   Clear_Text();
                   var url = '<%=Url.Action("Register","TailLine") %>?shift=' + shift + '&emp=' + emp + '&code=' + code;
                   //window.open(url, "Header_line", "fullscreen=yes ,scrollbars=yes");
                   window.open(url, "Header_line", "fullscreen=yes,menubar=0,location=0,status=0 ");
               }
           }); //click

           function Clear_Text() {
               $("#txtShift").val("1");
               $("#txtname").val("");
               $("#code").val("").focus();
           }

           $("#exit").button({
               icons: { primary: "" }
           }).click(function () {
               window.close();
           }); ;
           $("#txtShift").setMask("3");
       });
   </script>
</asp:Content>
